﻿namespace Basmus.Conel
{
    public class ValueTypeEntityBinding<TElement> : Binding
        //where TElement : struct 
    {
        public ValueTypeEntityBinding()
            : base(typeof(TElement))
        {

        }

        public override object[] GetElements(object container)
        {
            return new object[] {(TElement) container};
        }

        public override object GetContainer(object[] elements)
        {
            if (elements == null || elements.Length == 0 || elements[0] == null)
                return default(TElement);
            return elements[0];
        }
    }
}
